package net.moonbiter.ebs;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

import java.util.List;

public class ServiceDef {
	private Map<String,InputDef> inputs;
	private Method serviceMethod; 
	private Object serviceInstance;
	private List<String> orderedInputNamesList;
	
	public ServiceDef(Object inst, Method srvMet){
		this.serviceInstance = inst;
		this.serviceMethod = srvMet;
		inputs = new HashMap<String,InputDef>();
		orderedInputNamesList = new LinkedList<String>();
	}
	
	public Map<String,InputDef> getInputs(){
		return inputs;
	}
	
	public void addInput(String name, InputDef def){
		inputs.put(name, def);
		orderedInputNamesList.add(name);
	}

	public Method getServiceMethod() {
		return serviceMethod;
	}

	public Object getServiceInstance() {
		return serviceInstance;
	}

	public String[] getOrderedInputNames() {
		return orderedInputNamesList.toArray(new String[]{});
	}
	
}
